﻿using System;
using System.Data;
using System.Collections.Generic;

using System.Text;

namespace TimKen.BussLogic
{
    /// <summary>
    /// 用户管理类
    /// </summary>
    public class CustomerManager
    {
        private readonly TimKen.DataAccess.CustomerDAO dal = new TimKen.DataAccess.CustomerDAO();
        public CustomerManager()
        { }
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int CustomerID)
        {
            return dal.Exists(CustomerID);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(TimKen.DataEntity.Customer model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(TimKen.DataEntity.Customer model)
        {
            dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(int CustomerID)
        {

            dal.Delete(CustomerID);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TimKen.DataEntity.Customer GetModel(int CustomerID)
        {

            return dal.GetModel(CustomerID);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }

        public DataSet GetEnableCustomerNameAndID(string strWhere) 
        {
           return dal.GetEnableCustomerNameAndID(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>            
        /// 分页获取数据列表  
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="CustomerName"></param>
        /// <param name="CardCode"></param>
        /// <param name="orderString">排序字段名 </param>
        /// <param name="orderType">设置排序类型, 非 0 值则降序 </param>
        /// <returns></returns>
        public DataSet GetPageList(int PageSize, int PageIndex, string CustomerName, string CardCode, string orderString, int orderType)
        {
            return dal.GetList(PageSize, PageIndex, CustomerName, CardCode, orderString, orderType);
        }

        #endregion  成员方法
    }
}

